package com.bingyuan.aipassproject.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;

public class BitmapUtils {
    public static Bitmap getViewBitmap(Context context,int layoutId) {

        View view =  View.inflate(context,layoutId,null);

        int me = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);

        view.measure(me,me);

        view.layout(0 ,0, view.getMeasuredWidth(), view.getMeasuredHeight());

        view.buildDrawingCache();

        Bitmap bitmap = view.getDrawingCache();



        return bitmap;

    }
}
